package com.Merlin.myapplication

import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class activity_button : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_button)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        val btn2 = findViewById<View>(R.id.btn2)
        btn2.setOnClickListener {
            Toast.makeText(this, "点击了B按钮", Toast.LENGTH_SHORT).show()
        }
    }

    fun onClickMe(view: View) {
        Toast.makeText(this, "点击了A按钮", Toast.LENGTH_SHORT).show()
    }
}